<?php

/**
 * Items filter form base class.
 *
 * @package    cmsot
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseItemsFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'url'              => new sfWidgetFormFilterInput(),
      'code_1c'          => new sfWidgetFormFilterInput(),
      'dt_on'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'dt_off'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'rank'             => new sfWidgetFormFilterInput(),
      'sw'               => new sfWidgetFormFilterInput(),
      'sw_menu'          => new sfWidgetFormFilterInput(),
      'sw_index'         => new sfWidgetFormFilterInput(),
      'meta_title'       => new sfWidgetFormFilterInput(),
      'meta_keywords'    => new sfWidgetFormFilterInput(),
      'meta_description' => new sfWidgetFormFilterInput(),
      'item_name'        => new sfWidgetFormFilterInput(),
      'item_headline'    => new sfWidgetFormFilterInput(),
      'item_about'       => new sfWidgetFormFilterInput(),
      'item_description' => new sfWidgetFormFilterInput(),
      'site_name'        => new sfWidgetFormFilterInput(),
      'site_href'        => new sfWidgetFormFilterInput(),
      'item_type'        => new sfWidgetFormFilterInput(),
      'created_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'created_by'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Creator'), 'add_empty' => true)),
      'updated_by'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Updator'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'url'              => new sfValidatorPass(array('required' => false)),
      'code_1c'          => new sfValidatorPass(array('required' => false)),
      'dt_on'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'dt_off'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'rank'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'sw'               => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'sw_menu'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'sw_index'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'meta_title'       => new sfValidatorPass(array('required' => false)),
      'meta_keywords'    => new sfValidatorPass(array('required' => false)),
      'meta_description' => new sfValidatorPass(array('required' => false)),
      'item_name'        => new sfValidatorPass(array('required' => false)),
      'item_headline'    => new sfValidatorPass(array('required' => false)),
      'item_about'       => new sfValidatorPass(array('required' => false)),
      'item_description' => new sfValidatorPass(array('required' => false)),
      'site_name'        => new sfValidatorPass(array('required' => false)),
      'site_href'        => new sfValidatorPass(array('required' => false)),
      'item_type'        => new sfValidatorPass(array('required' => false)),
      'created_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'created_by'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Creator'), 'column' => 'id')),
      'updated_by'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Updator'), 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('items_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Items';
  }

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'url'              => 'Text',
      'code_1c'          => 'Text',
      'dt_on'            => 'Date',
      'dt_off'           => 'Date',
      'rank'             => 'Number',
      'sw'               => 'Number',
      'sw_menu'          => 'Number',
      'sw_index'         => 'Number',
      'meta_title'       => 'Text',
      'meta_keywords'    => 'Text',
      'meta_description' => 'Text',
      'item_name'        => 'Text',
      'item_headline'    => 'Text',
      'item_about'       => 'Text',
      'item_description' => 'Text',
      'site_name'        => 'Text',
      'site_href'        => 'Text',
      'item_type'        => 'Text',
      'created_at'       => 'Date',
      'updated_at'       => 'Date',
      'created_by'       => 'ForeignKey',
      'updated_by'       => 'ForeignKey',
    );
  }
}
